#pragma once
#include "Globals.h"
#include "DirectInput.h"
class Camera
{
private:
	D3DXVECTOR3	EyePos;		// position of the camera in world space
	D3DXVECTOR3 LookAt;		// point that the camera is facing
	D3DXVECTOR3	UpVec;		// which way is up; should be a normalized vector
	

public:
	Camera()
	{
		EyePos = D3DXVECTOR3(4.5f, 8.0f, -12.0f);
		LookAt = D3DXVECTOR3(4.5f, 0.0f,  -3.5f);
		UpVec  = D3DXVECTOR3( 0.0f, 1.0f,  0.0f);
	}

	void Move()
	{
		/*These are indeed magic numbers*/
		if(DirectInput::Into()->KeyDown(DIK_UP))		{EyePos.z <  -4.0f ? EyePos.z += 0.2f : EyePos.z =  -4.0f;}
		if(DirectInput::Into()->KeyDown(DIK_DOWN))		{EyePos.z > -19.0f ? EyePos.z -= 0.2f : EyePos.z = -19.0f;}
		if(DirectInput::Into()->KeyDown(DIK_RIGHT))		{EyePos.x <  19.5f ? EyePos.x += 0.2f : EyePos.x =  19.5f;}
		if(DirectInput::Into()->KeyDown(DIK_LEFT))		{EyePos.x > -10.5f ? EyePos.x -= 0.2f : EyePos.x = -10.5f;}
		if(DirectInput::Into()->KeyDown(DIK_PGUP))		{EyePos.y <	 18.0f ? EyePos.y += 0.2f : EyePos.y =  18.0f;}
		if(DirectInput::Into()->KeyDown(DIK_PGDN))		{EyePos.y >   3.0f ? EyePos.y -= 0.2f : EyePos.y =   3.0f;}
		if(DirectInput::Into()->KeyDown(DIK_HOME))		{EyePos = D3DXVECTOR3( 4.5f, 8.0f, -12.0f);}
	}

	D3DXMATRIX SetView()
	{
		D3DXMATRIX	ViewMat;
		D3DXMatrixLookAtLH(&ViewMat,&EyePos, &LookAt, &UpVec);
		return ViewMat;
	};
};